import { http } from "@/utils/http";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

// 查询报警信息
export const queryAlarmList = (data?: Record<string, any>) => {
  return http.request<ResultTable>("post", "/erc/api/v1/alarm/query", {
    data
  });
};

// 更新报警状态
export const updateAlarm = (data?: Record<string, any>) => {
  return http.request("post", "/ercAdapter/api/v1/ercAlarmRecord/close", {
    data
  });
};

// 获取枚举
export const getAlarmEnum = (data?: Record<string, any>) => {
  return http.request("get", "/erc/api/v1/alarm/enum/query", {
    data
  });
};

// 获取报警数目
export const getAlarmCount = (data?: Record<string, any>) => {
  return http.request("get", "/erc/api/v1/alarm/count", {
    data
  });
};

// 根据事件类型获取报警文档
export const getAlarmEvent = (data?: Record<string, any>) => {
  return http.request("post", "/erc/api/v1/alarmDocument/getAlarmDocumentsByEventType", {
    data
  });
};

// 查询自定义报警信息接口
export const getAlarmEventList = (data?: Record<string, any>) => {
  return http.request<ResultTable>("post", "/erc/api/v1/alarm/custom/query", {
    data
  });
};

// 新增自定义报警信息接口
export const addAlarmEvent = (data?: Record<string, any>) => {
  return http.request("post", "/erc/api/v1/alarm/custom/create", {
    data
  });
};

// 更新自定义报警信息接口
export const editAlarmEvent = (data?: Record<string, any>) => {
  return http.request("post", "/erc/api/v1/alarm/custom/update", {
    data
  });
};

// 获取自定义报警信息接口
export const getAlarmEventDetail = (data?: Record<string, any>) => {
  return http.request<Record<string, any>>("post", "/erc/api/v1/alarm/custom/get", {
    data
  });
};

// 拨打报警电话接口
export const callApi = (data?: Record<string, any>) => {
  return http.request<Record<string, any>>("post", "/erc/api/v1/alarm/call", {
    data
  });
};
